<template>
  <div>
    <ul>
      <li>
        <router-link to="/contacts/all_contacts">All_Contacts</router-link>
      </li>
      <li><router-link to="/contacts/alice">Alice</router-link></li>
      <li><router-link to="/contacts/bob">Bob</router-link></li>
    </ul>
    <button @click="btn">随机显示</button>
    <div>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["All_Contacts", "Alice", "Bob"],
    };
  },
  methods: {
    btn() {
      const random = Math.floor(Math.random() * 3);
      // console.log(random);
      this.$router.push({
        // path: targetPath,
        name: this.arr[random],
      });
    },
  },
};
</script>

<style>
</style>